package com.lbyl.util;

import org.codehaus.jackson.map.ObjectMapper;

import java.io.IOException;

/**
 * 通过URL得到标准的Json数组或Json对象
 *
 * @author libin996@outlook.com
 */

public class JsonUtil {
    private static final String TAG = "JsonUtil";

    public static Object fillBeanByResponse(String responseStr, Class cla) {
        Object o = null;
        ObjectMapper mapper = new ObjectMapper();
        try {
            o = mapper.readValue(responseStr, cla);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return o;
    }

}
